package br.com.nutriplus.model;

import java.util.ArrayList;
import java.util.List;

import javax.swing.DefaultComboBoxModel;

import br.com.nutriplus.dao.ClientJPAController;
import br.com.nutriplus.entity.Client;

public class UserComboBoxModel extends DefaultComboBoxModel<Client>   {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private List<Client> clientes  = new ArrayList<Client>();
	
	public void updateItems(){
		clientes = ClientJPAController.listClients();
		fireIntervalAdded(this, 0, clientes.size());
	}
	
	@Override
	public int getSize() {
		return clientes.size();
	}

	@Override
	public Client getElementAt(int index) {
		return clientes.get(index);
	}


}
